<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>B2C商城首页</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
    <link rel="stylesheet" type="text/css" href="../../../h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../h-ui.admin/css/style.css" />

</head>

<body>
<article class="cl pd-20">
    <form th:action="@{doUserReceiveEdit}" method="post" class="form form-horizontal" id="form-receive-edit">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>收货人姓名：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${userReceive.contact}" placeholder="输入不得超过8个字符" id="contact" name="contact">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机号码：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" th:value="${userReceive.tel}" placeholder="请输入11位手机号码" id="tel" name="tel">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所在地区：</label>
            <div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
					<select class="select" size="1" id="province" name="receiveProvince" style="width:180px"></select>
					<select class="select" size="1" id="city" name="receiveCity" style="width:180px"></select>
					<select class="select" size="1" id="country" name="receiveCounty" style="width:180px"></select>
				</span>
                <div id="show"></div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>详细地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea th:text="${userReceive.receiveAddress}" id="receiveAddress" name="receiveAddress" cols="" rows="" class="textarea"  placeholder="建议您如实填写详细收货地址，例如街道 名称，门牌号码，楼层和房间号等信息"></textarea>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" name="receiveId" th:value="${userReceive.receiveId}"/>
                <input type="hidden" id="old_province" th:value="${userReceive.receiveProvince}">
                <input type="hidden" id="old_city" th:value="${userReceive.receiveCity}">
                <input type="hidden" id="old_country" th:value="${userReceive.receiveCounty}">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button id="reset" class="btn btn-default radius" type="reset">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</article>

<!-- 引入城市三级联动js -->
<script type="text/javascript" src="../../../my/area.js"></script>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="../../../lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="../../../h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="../../../h-ui.admin/js/H-ui.admin.page.js"></script>
<script type="text/javascript" src="../../../lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="../../../lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });


        /**
         * 表单校验
         */
        $("#form-receive-edit").validate({
            rules:{
                receiveProvince:{
                    required:true
                },
                city:{
                    required:true
                },
                country:{
                    required:true
                },
                receiveAddress:{
                    required:true
                },
                contact:{
                    required:true,
                    maxlength:8
                },
                tel:{
                    required:true,
                    isMobile:true,
                }
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    dateType: "json",
                    success: function (result) {
                        if(result.flag == "true"){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.msg("编辑成功,请刷新!",{icon: 6,time:1000});
                            parent.layer.close(index);
                        }
                        if(result.flag == "false"){
                            layer.msg("编辑失败!",{icon: 2,time:1000});
                        }
                    },
                    error: function (err) {
                        layer.msg('请求异常!',{icon: 2,time:1000})
                    }
                });
            }
        });


        /**
         * 城市三级联动
         * */
            // 获取用户原始数据
        var old_province = $("#old_province").val();
        var old_city = $("#old_city").val();
        var old_country = $("#old_country").val();
        // 默认值初始化
        opt0 = [old_province,old_city,old_country];//初始值
        _init_area();

    });
</script>
<!--/请在上方写此页面业务相关的脚本-->


</body>
</html>
